Added I/O debugging mode.
authorEwan Mellor <ewan@xensource.com>
Sun, 25 Mar 2007 23:17:17 +0000 (00:17 +0100)
committerEwan Mellor <ewan@xensource.com>
Sun, 25 Mar 2007 23:17:17 +0000 (00:17 +0100)
Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/libxen/test/test_bindings.c

index 0904ec3ca8554eef942fc0249c27e8953be75fe2..96ac6ef12f7fa829ae194f4bb10c6ea41eec639b 100644 (file)
@@ -34,6 +34,7 @@
 #include "xen_vm.h"
 #include "xen_vm_metrics.h"
 
+//#define PRINT_XML
 
 static void usage()
 {
@@ -71,6 +72,11 @@ static size_t
 write_func(void *ptr, size_t size, size_t nmemb, xen_comms *comms)
 {
     size_t n = size * nmemb;
+#ifdef PRINT_XML
+    printf("\n\n---Result from server -----------------------\n");
+    printf("%s\n",((char*) ptr));
+    fflush(stdout);
+#endif
     return comms->func(ptr, n, comms->handle) ? n : 0;
 }
 
@@ -81,6 +87,12 @@ call_func(const void *data, size_t len, void *user_handle,
 {
     (void)user_handle;
 
+#ifdef PRINT_XML
+    printf("\n\n---Data to server: -----------------------\n");
+    printf("%s\n",((char*) data));
+    fflush(stdout);
+#endif
+
     CURL *curl = curl_easy_init();
     if (!curl) {
         return -1;